<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>继承-借用构造器模式</title>
</head>
<body>

</body>
<script>

    function SuperType() { /*父类别*/
        this.name = "L";
        this.colors = ["white"]; // 引用类型
    }


    function SubType() { /*子类别*/
       SuperType.call(this); // 借用构造器 --- 实例生成/函数触发时
    }

    var sub1 = new SubType();
    var sub2 = new SubType();

    sub1.colors.push("red");
    sub2.colors.push("black");

    console.log(sub1.colors);
    console.log(sub2.colors);


</script>
</html>